/*
 * Created: Author: Aléx Carvalho / Date: Jan 23, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-05-13 13:23:31 +0000 (Wed, 13 May 2015) $
 */

package com.cpm.entities.converters;

import com.cpm.entities.types.ActionStateType;
import javax.persistence.AttributeConverter;
import javax.persistence.Converter;

@Converter(autoApply = true)
public class ActionStatePersistenceConverter implements AttributeConverter<ActionStateType, Byte> {

    @Override
    public Byte convertToDatabaseColumn(ActionStateType attribute) {
        return TypeConverter.getId(attribute);
    }

    @Override
    public ActionStateType convertToEntityAttribute(Byte dbData) {
        return TypeConverter.convertTo(ActionStateType.class, dbData);
    }
    
}